﻿// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone

using BlazorAdmin.Interface;
using BootstrapBlazor.Components;
using Microsoft.Extensions.DependencyInjection.Extensions;
using BlazorAdmin.Services.DbService;
using Microsoft.Extensions.DependencyInjection;
using Pangeo.Admin.Services;

namespace BlazorAdmin.Services
{
    /// <summary>
    /// 
    /// </summary>
    public static class _ServiceRegister
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="services"></param>
        /// <returns></returns>
        public static IServiceCollection AddPetaPocoDataAccessServices(this IServiceCollection services)
        {
            services.TryAddSingleton<ISqlSugar, SqlSugarService>();
            services.TryAddSingleton<IPetaPoco, PetaPocoService>();

            // 增加缓存服务
            services.AddCacheManager();

            // 增加业务服务
            services.AddSingleton<IBootstrapAdminService, AdminService>();
            services.AddSingleton<IApp, AppService>();
            services.AddSingleton<IDict, DictService>();
            services.AddSingleton<IException, ExceptionService>();
            services.AddSingleton<IGroup, GroupService>();
            services.AddSingleton<ILog, LogService>();
            services.AddSingleton<INavigation, NavigationService>();
            services.AddSingleton<IRole, RoleService>();
            services.AddSingleton<IUser, UserService>();
            services.AddSingleton<ITrace, TraceService>();
            services.AddSingleton<IJob, JobService>();
            services.AddSingleton<ISettings, SettingsService>();
            services.AddSingleton<IOrganize, OrganizeService>();
            services.AddSingleton<IEmailTasks, EmailTasksService>();

            return services;
        }
    }
}